package com.ankiang.treeprint.fragment.home;

import android.content.Context;

import com.ankiang.treeprint.R;
import com.ankiang.treeprint.fragment.util.TRPages;
import com.ankiang.treeprint.fragment.util.TRUtils;
import com.ankiang.treeprint.manager.QDDataManager;
import com.ankiang.treeprint.view.TRConfig;
import com.qmuiteam.qmui.widget.grouplist.QMUIGroupListView;

import butterknife.BindView;

/**
 * @author cginechen
 * @date 2016-10-20
 */

public class HomeExploreController extends HomeController {


    private final TRBanner banner;
    // 配置
    private TRConfig conf;


    @BindView(R.id.groupListView)
    QMUIGroupListView mGroupListView;

    public HomeExploreController(Context context) {
        super(context, R.layout.home_explore_layout);

        initRecyclerView();
        initGroupListView();
        banner = new TRBanner();
        banner.initBanner(this);
    }

    @Override
    protected String getTitle() {
        return V(R.string.home_explore);
    }

    @Override
    protected ItemAdapter getItemAdapter() {
        return new ItemAdapter(getContext(), QDDataManager.getInstance(getContext()).getLabDescriptions());
    }




    private void initGroupListView() {


        QMUIGroupListView.Section section = QMUIGroupListView.newSection(getContext());
        TRUtils.addFunctionItem(section, mGroupListView, V(R.string.explore_calculator), R.drawable.ic_icon_min_calculator, (v) -> {
            TRPages.showCalculatorPage(HomeExploreController.this);
        });
        section.addTo(mGroupListView);



        section = QMUIGroupListView.newSection(getContext());
        TRUtils.addFunctionItem(section, mGroupListView, V(R.string.explore_address_map), R.drawable.ic_icon_min_address_map, (v) ->
                TRPages.showAddresMapPage(HomeExploreController.this)
        );
        TRUtils.addFunctionItem(section, mGroupListView, V(R.string.explore_analysis),R.drawable.ic_icon_min_data_analysis,
                (v) -> TRPages.showAnalysisPage(HomeExploreController.this));
        TRUtils.addFunctionItem(section, mGroupListView, V(R.string.explore_show_data), R.drawable.ic_icon_min_text,
                (v) -> TRPages.showDataTextPage(HomeExploreController.this));
        section.addTo(mGroupListView);


        section = QMUIGroupListView.newSection(getContext());
        TRUtils.addFunctionItem(section, mGroupListView, V(R.string.explore_redpacket_distribute),R.drawable.ic_icon_min_redpacket,
                (v) -> TRPages.showRedpacketDistributePage(HomeExploreController.this));

        TRUtils.addFunctionItem(section, mGroupListView, V(R.string.explore_gift_suggest),R.drawable.ic_icon_min_gift_suggest,
                (v) -> TRPages.showGiftSuggestPage(HomeExploreController.this));
        section.addTo(mGroupListView);


        section = QMUIGroupListView.newSection(getContext());
        TRUtils.addFunctionItem(section, mGroupListView, V(R.string.explore_history_knowledge),R.drawable.ic_icon_min_example_data,
                (v) -> TRPages.showHistoryKnowledgePage(HomeExploreController.this));
        section.addTo(mGroupListView);

    }


}
